<template>
  <swiper>
    <swiper-item v-for="itme in banners" :key="banners.index">
      <a :href="itme.link">
        <img :src="itme.image" alt="" @load="imageload" />
      </a>
    </swiper-item>
  </swiper>
</template>

<script>
import { Swiper, SwiperItem } from "components/common/swiper"; //导入轮播图
export default {
  name: "homeswiper",
  props: {
    banners: {
      typr: Array,
      default() {
        //设置默认值为一个函数 返回一个数组
        return [];
      },
    },
  },
  data() {
    return {
      isload: false,
    };
  },
  components: {
    Swiper,
    SwiperItem,
  },
  methods: {
    imageload() {
      if (!this.isload) {
        this.$emit("swiperimageload");
        this.isload = true;
      }
    },
  },
};
</script>

<style scoped>
</style>